package main

import (
	"encoding/json"
	"fmt"
)

type Str struct {
	Name string `json:"name"`
	Age  int    `json:"age"`
}

func main() {
	var p Str
	str := `{"name":"yi","age":12}`
	err := json.Unmarshal([]byte(str), &p)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(p)
}
